package com.ruoyi.web.core.config;

import com.ruoyi.by.health.domain.entity.ByhealthPrize;
import com.ruoyi.by.health.service.IByhealthPrizeService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.ListOperations;
import org.springframework.data.redis.core.RedisTemplate;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName PrizeInitConfig
 * @Author 张敬琦
 * @Description 添加描述
 * @Date 2024/1/19 02:37
 **/
public class PrizeInitConfig {
    private static final Logger log = LoggerFactory.getLogger(PrizeInitConfig.class);
    @Autowired
    IByhealthPrizeService prizeService;
    @Resource
    RedisTemplate<String, Object> redisTemplate;

    @PostConstruct
    public void initGameScoreRegion() {
        List<ByhealthPrize> prizes = prizeService.getByhealthPrizeList();
        for (ByhealthPrize p : prizes) {
            redisTemplate.opsForHash().put("prize_info", p.getId(), p);
        }


    }
}
